﻿using CJAtech.BBS.Business;
using CJAtech.BBS.DataEntity;
using CJAtech.BBS.Web.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bigger.Framework;
using Bigger.Base.Cache;
using CJAtech.BBS.Web.Models;
using CJAtech.BBS.Process;
using Bigger.Base;
using Bigger.Web.Helper;
using Bigger.Qiniu;

namespace CJAtech.BBS.Web.Controllers
{
    public partial class BBSController
    {
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <param name="categoryId">栏目Id</param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public virtual ActionResult ArticleListJson(int? categoryId, int? pageIndex = 1, int? pageSize = 10)
        {
            if (!pageIndex.HasValue || pageIndex <= 0)
            {
                pageIndex = 1;
            }
            if (!pageSize.HasValue || pageSize <= 0 || pageSize > 20)
            {
                pageSize = 10;
            }
            InvokeResult objInvokeResult = new InvokeResult();
            BizArticleInfo objBizArticleInfo = new BizArticleInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            List<ArticleInfo> objList = null;
            if (categoryId.HasValue)
            {
                objList = objBizArticleInfo.GetPageListCache("", TimeSpan.FromSeconds(5), pageIndex.Value - 1, pageSize.Value, "CategoryId=" + categoryId.Value + " AND IsRelease=1", "ArticleId desc");
            }
            else
            {
                objList = objBizArticleInfo.GetPageListCache("", TimeSpan.FromSeconds(5), pageIndex.Value - 1, pageSize.Value, "IsRelease=1", "ArticleId desc");
            }
            if (objList.IsNull())
            {
                objInvokeResult.ResultCode = "ArticleInfoNull";
                objInvokeResult.ResultMessage = "没有更多文章了";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            //加载文章相关统计信息
            //LoadArticleRelatedCount(objList);
            LoadDiggList(objList);
            objInvokeResult.Data = objList.CreateArticleResultInfoList(false, false, null, CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="isRelease">是否已审核</param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public virtual ActionResult UserArticleListJson(string userId, int isRelease = 1, int? pageIndex = 1)
        {
            if (userId.IsNull())
            {
                userId = this.CurrentUserInfo.UserId;
            }
            if (!pageIndex.HasValue || pageIndex <= 0)
            {
                pageIndex = 1;
            }
            InvokeResult objInvokeResult = new InvokeResult();
            BizArticleInfo objBizArticleInfo = new BizArticleInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            List<ArticleInfo> objList = null;
            objList = objBizArticleInfo.GetPageListCache("", TimeSpan.FromSeconds(5), pageIndex.Value - 1, 10, "ObjectId=@ObjectId AND IsRelease=" + isRelease, new { ObjectId = userId }, "ArticleId desc");
            if (objList.IsNull())
            {
                objInvokeResult.ResultCode = "ArticleInfoNull";
                objInvokeResult.ResultCode = "没有更多文章了";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            //加载文章相关统计信息
            //LoadArticleRelatedCount(objList);
            if (!string.Equals(userId, this.CurrentUserInfo.UserId))
            {
                LoadDiggList(objList);
            }
            objInvokeResult.Data = objList.CreateArticleResultInfoList(false, false, null, CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 获取文章详情
        /// </summary>
        /// <param name="id"></param>
        /// <param name="isPictureThumbnail"></param>
        /// <param name="isContentThumbnail"></param>
        /// <returns></returns>
        public virtual ActionResult GetArticle(int? id, int? isPictureThumbnail = 1, int? isContentThumbnail = 0)
        {
            InvokeResult objInvokeResult = new Bigger.Framework.InvokeResult();
            if (!id.HasValue)
            {
                objInvokeResult.ResultCode = "IDEmpty";
                objInvokeResult.ResultMessage = "ID不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            ArticleInfoProcess objArticleInfoProcess = new ArticleInfoProcess(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            ArticleResultInfo objArticleResultInfo = objArticleInfoProcess.GetArticleResultInfo(id.Value, true, true);
            if (objArticleResultInfo == null || objArticleResultInfo.ArticleInfo == null)
            {
                objInvokeResult.ResultCode = "ArticleEmpty";
                objInvokeResult.ResultMessage = "文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            if (objArticleResultInfo.ArticleInfo.IsRelease != 1 && !string.Equals(objArticleResultInfo.ArticleInfo.ObjectId, this.CurrentUserInfo.UserId))
            {
                objInvokeResult.ResultCode = "ArticleIllegal";
                objInvokeResult.ResultMessage = "对不起，当前文章还在审核中";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            if (isPictureThumbnail.HasValue && isPictureThumbnail.Value == 1)
            {
                if (objArticleResultInfo.ArticlePictureCollection.IsNoNull())
                {
                    foreach (ArticlePicture objArticlePicture in objArticleResultInfo.ArticlePictureCollection)
                    {
                        objArticlePicture.PictureUrl = objArticlePicture.PictureUrl.CreateThumbnailByWidth(800);
                    }
                }
            }
            if (isContentThumbnail.HasValue && isContentThumbnail.Value == 1)
            {
                objArticleResultInfo.ArticleContent = objArticleResultInfo.ArticleContent.CreateThumbnailByWidthFromContent(800);
            }

            //加载文章相关统计信息
            //LoadArticleRelatedCount(objArticleInfo);

            LoadDigg(objArticleResultInfo.ArticleInfo);

            objInvokeResult.Data = objArticleResultInfo;

            return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 文章点赞
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual ActionResult DiggArticle(int? id)
        {
            InvokeResult objInvokeResult = new InvokeResult();
            if (!id.HasValue)
            {
                objInvokeResult.ResultCode = "ArticleIdEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            BizArticleInfo objBizArticleInfo = new BizArticleInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            ArticleInfo objArticleInfo = objBizArticleInfo.GetRecord(id.Value);
            if (objArticleInfo == null)
            {
                objInvokeResult.ResultCode = "ArticleInfoEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }

            BizDiggInfo objBizDiggInfo = new BizDiggInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            //bool hasDigg = objBizDiggInfo.Any("UserId=@UserId AND ObjectCode=@ObjectCode", "UserId,ObjectCode".CreateSqlParameters(UserId, "Article_" + id));
            bool hasDigg = objBizDiggInfo.Any("ObjectType='Digg' AND UserId=@UserId AND ObjectCode=@ObjectCode AND datediff(day,[DiggTime],getdate())=0", new { UserId = this.CurrentUserInfo.UserId, ObjectCode = "Article_" + id });
            if (hasDigg)
            {
                objInvokeResult.ResultCode = "DiggAlready";
                objInvokeResult.ResultMessage = "对不起，你已对该文章点赞过";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            DiggInfo objDiggInfo = new DiggInfo
            {

                ObjectId = id.Value.ToString(),
                ObjectCode = "Article_" + id,
                ObjectType = "Digg",
                UserId = this.CurrentUserInfo.UserId,
                UserIP = SystemWebAsset.GetClientIP(),
                DiggTime = DateTime.Now
            };
            objBizDiggInfo.Add(objDiggInfo);
            objBizArticleInfo.Update("DiggCount=DiggCount+1", id.Value);

            objInvokeResult.ResultMessage = "点赞成功";
            return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
        }


        /// <summary>
        /// 取消文章点赞
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual ActionResult UnDiggArticle(int? id)
        {
            InvokeResult objInvokeResult = new InvokeResult();
            if (!id.HasValue)
            {
                objInvokeResult.ResultCode = "ArticleIdEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            BizArticleInfo objBizArticleInfo = new BizArticleInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            ArticleInfo objArticleInfo = objBizArticleInfo.GetRecord(id.Value);
            if (objArticleInfo == null)
            {
                objInvokeResult.ResultCode = "ArticleInfoEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }

            BizDiggInfo objBizDiggInfo = new BizDiggInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            //bool hasDigg = objBizDiggInfo.Any("UserId=@UserId AND ObjectCode=@ObjectCode", "UserId,ObjectCode".CreateSqlParameters(UserId, "Article_" + id));
            DiggInfo objDiggInfo = objBizDiggInfo.GetRecord("ObjectType='Digg' AND UserId=@UserId AND ObjectCode=@ObjectCode AND datediff(day,[DiggTime],getdate())=0", new { UserId = this.CurrentUserInfo.UserId, ObjectCode = "Article_" + id });
            if (objDiggInfo == null)
            {
                objInvokeResult.ResultCode = "HaveNotDigg";
                objInvokeResult.ResultMessage = "对不起，你没有对该文章点赞过";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            objBizDiggInfo.Delete(objDiggInfo.DiggId);
            objBizArticleInfo.Update("DiggCount=DiggCount-1", id.Value);

            objInvokeResult.ResultMessage = "取消点赞成功";
            return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
        }


        /// <summary>
        /// 文章点踩
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual ActionResult BuryArticle(int? id)
        {
            InvokeResult objInvokeResult = new InvokeResult();
            if (!id.HasValue)
            {
                objInvokeResult.ResultCode = "ArticleIdEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            BizArticleInfo objBizArticleInfo = new BizArticleInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            ArticleInfo objArticleInfo = objBizArticleInfo.GetRecord(id.Value);
            if (objArticleInfo == null)
            {
                objInvokeResult.ResultCode = "ArticleInfoEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }

            BizDiggInfo objBizDiggInfo = new BizDiggInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            //bool hasDigg = objBizDiggInfo.Any("UserId=@UserId AND ObjectCode=@ObjectCode", "UserId,ObjectCode".CreateSqlParameters(UserId, "Article_" + id));
            bool hasBury = objBizDiggInfo.Any("ObjectType='Bury' AND UserId=@UserId AND ObjectCode=@ObjectCode AND datediff(day,[DiggTime],getdate())=0", new { UserId = this.CurrentUserInfo.UserId, ObjectCode = "Article_" + id });
            if (hasBury)
            {
                objInvokeResult.ResultCode = "BuryAlready";
                objInvokeResult.ResultMessage = "对不起，你已对该文章点踩过";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            DiggInfo objDiggInfo = new DiggInfo
            {

                ObjectId = id.Value.ToString(),
                ObjectCode = "Article_" + id,
                ObjectType = "Bury",
                UserId = this.CurrentUserInfo.UserId,
                UserIP = SystemWebAsset.GetClientIP(),
                DiggTime = DateTime.Now
            };
            objBizDiggInfo.Add(objDiggInfo);
            objBizArticleInfo.Update("BuryCount=BuryCount+1", id.Value);

            objInvokeResult.ResultMessage = "点踩成功";
            return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
        }


        /// <summary>
        /// 文章点踩
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual ActionResult UnBuryArticle(int? id)
        {
            InvokeResult objInvokeResult = new InvokeResult();
            if (!id.HasValue)
            {
                objInvokeResult.ResultCode = "ArticleIdEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            BizArticleInfo objBizArticleInfo = new BizArticleInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            ArticleInfo objArticleInfo = objBizArticleInfo.GetRecord(id.Value);
            if (objArticleInfo == null)
            {
                objInvokeResult.ResultCode = "ArticleInfoEmpty";
                objInvokeResult.ResultMessage = "对不起，文章不存在";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }

            BizDiggInfo objBizDiggInfo = new BizDiggInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            //bool hasDigg = objBizDiggInfo.Any("UserId=@UserId AND ObjectCode=@ObjectCode", "UserId,ObjectCode".CreateSqlParameters(UserId, "Article_" + id));
            DiggInfo objDiggInfo = objBizDiggInfo.GetRecord("ObjectType='Bury' AND UserId=@UserId AND ObjectCode=@ObjectCode AND datediff(day,[DiggTime],getdate())=0", new { UserId = this.CurrentUserInfo.UserId, ObjectCode = "Article_" + id });
            if (objDiggInfo == null)
            {
                objInvokeResult.ResultCode = "HaveNotBury";
                objInvokeResult.ResultMessage = "对不起，你没有对该文章点踩过";
                return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
            }
            objBizDiggInfo.Delete(objDiggInfo.DiggId);
            objBizArticleInfo.Update("BuryCount=BuryCount-1", id.Value);

            objInvokeResult.ResultMessage = "取消点踩成功";
            return Json(objInvokeResult, JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 用户发表文章
        /// </summary>
        /// <param name="categoryId"></param>
        /// <param name="title"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        [HttpPost]
        [ValidateInput(false)]
        public virtual ActionResult AddArticle(int? categoryId, string title, string content, string imageList)
        {
            InvokeResult objInvokeResult = new InvokeResult();
            if (title.IsNull())
            {
                objInvokeResult.ResultCode = "TitleNull";
                objInvokeResult.ResultMessage = "对不起，文章标题不能为空";
                return Json(objInvokeResult);
            };
            if (content.IsNull())
            {
                objInvokeResult.ResultCode = "ContentNull";
                objInvokeResult.ResultMessage = "对不起，文章内容不能为空";
                return Json(objInvokeResult);
            }
            string[] badwordsList = title.SearchMatchBadWords(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            if (badwordsList.IsNoNull())
            {
                objInvokeResult.ResultCode = "TitleHasBadWords";
                objInvokeResult.ResultMessage = "对不起，文章标题包含敏感信息词汇 " + badwordsList[0];
                return Json(objInvokeResult);
            }
            badwordsList = content.SearchMatchBadWords(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            if (badwordsList.IsNoNull())
            {
                objInvokeResult.ResultCode = "ContentHasBadWords";
                objInvokeResult.ResultMessage = "对不起，文章内容包含敏感信息词汇 " + badwordsList[0];
                return Json(objInvokeResult);
            }

            if (!categoryId.HasValue)
            {
                objInvokeResult.ResultCode = "CategoryIdNull";
                objInvokeResult.ResultMessage = "对不起，版块Id不存在";
                return Json(objInvokeResult);
            }
            BizCategoryInfo objBizCategoryInfo = new BizCategoryInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            //todo:版块是否禁止发帖
            CategoryInfo objCategoryInfo = objBizCategoryInfo.GetRecordCache("", categoryId.Value, TimeSpan.FromMinutes(1));
            if (objCategoryInfo == null)
            {
                objInvokeResult.ResultCode = "CategoryNull";
                objInvokeResult.ResultMessage = "对不起，版块不存在";
                return Json(objInvokeResult);
            }

            var CurrentCache = Bigger.Core.Cache.CacheHelper.CacheInstance;
            string cacheKey = this.CurrentCommunityConfig.ConfigCode + "_LastArticle_" + this.CurrentUserInfo.UserId;
            //获取上一次评论缓存
            ArticleInfo objLastArticleInfo = CurrentCache.GetCache<ArticleInfo>(cacheKey);
            if (objLastArticleInfo != null && objLastArticleInfo.CreateDate.AddSeconds(5).IsGreaterThanCurrent())
            {
                objInvokeResult.ResultCode = "CommentFrequently";
                objInvokeResult.ResultMessage = "对不起，请你与上次发表文章的时间间隔5秒";
                return Json(objInvokeResult);
            }
            ArticleInfo objArticleInfo = new ArticleInfo();
            objArticleInfo.CategoryId = objCategoryInfo.CategoryId;
            objArticleInfo.CategoryIDPath = objCategoryInfo.IDPath;
            //objArticleInfo.CategoryId = 1;
            //objArticleInfo.CategoryIDPath = ",1,";
            objArticleInfo.ArticleTitle = title;
            objArticleInfo.ObjectId = this.CurrentUserInfo.UserId;
            objArticleInfo.ArticleAuthor = CurrentUserInfo.UserName.SetNullToDefaultValue(string.Empty);
            objArticleInfo.S1 = CurrentUserInfo.Avatar.SetNullToDefaultValue(string.Empty);
            BizArticleInfo objBizArticleInfo = new BizArticleInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            objBizArticleInfo.Add(objArticleInfo);
            objBizArticleInfo.Update("SortIndex=" + objArticleInfo.ArticleId, objArticleInfo.ArticleId);

            List<ArticleInfoData> objArticleInfoDataList = new List<ArticleInfoData>();

            ArticleInfoData objArticleInfoData = new ArticleInfoData
            {
                InfoDataType = ArticleInfoDataType.ArticleContent,
                ArticleId = objArticleInfo.ArticleId,
                ArticleContent = content
            };
            objArticleInfoData.SetState(EntityStatus.Added);
            objArticleInfoDataList.Add(objArticleInfoData);

            if (imageList.IsNoNull())
            {
                List<ArticlePicture> objArticlePictureList = new List<ArticlePicture>();
                ArticlePicture objArticlePicture = null;
                int i = 1;
                foreach (string imageKey in imageList.Split(','))
                {
                    objArticlePicture = new ArticlePicture
                    {
                        PictureUrl = string.Format("http://{0}/{1}", this.CurrentCommunityConfig.ServerPath, imageKey),
                        SortIndex = i
                    };
                    objArticlePictureList.Add(objArticlePicture);
                    i++;
                }
                objArticleInfoData = new ArticleInfoData
                {
                    InfoDataType = ArticleInfoDataType.ArticlePictureCollection,
                    ArticleId = objArticleInfo.ArticleId,
                    ArticleContent = objArticlePictureList.JsonSerialize()
                };
                objArticleInfoData.SetState(EntityStatus.Added);
                objArticleInfoDataList.Add(objArticleInfoData);
            }

            BizArticleInfoData objBizArticleInfoData = new BizArticleInfoData(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            objBizArticleInfoData.Batch(objArticleInfoDataList, false);

            //设置上一条评论缓存
            CurrentCache.SetCache(cacheKey, objArticleInfo, TimeSpan.FromSeconds(10));

            //objArticleInfo.ArticleContent = content;
            objInvokeResult.ResultMessage = "发布成功，请耐心等待管理员审核";

            return Json(objInvokeResult);
        }
        protected virtual void LoadDiggList(List<ArticleInfo> objList)
        {
            if (objList.IsNoNull())
            {
                BizDiggInfo objBizDiggInfo = new BizDiggInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
                string objectIDs = objList.Select(c => "Article_" + c.ArticleId).JoinComma().ConvertVarcharString();
                //List<DiggInfo> objDiggInfoList = objBizDiggInfo.GetListCache("", TimeSpan.FromSeconds(5), string.Format("ObjectCode in({0}) AND UserId='{1}'", objectIDs, UserId));
                List<DiggInfo> objDiggInfoList = objBizDiggInfo.GetListCache("", TimeSpan.FromSeconds(5), string.Format("ObjectType='Digg' AND ObjectCode in({0}) AND UserId='{1}' AND datediff(day,[DiggTime],getdate())=0", objectIDs, this.CurrentUserInfo.UserId));
                if (objDiggInfoList.IsNoNull())
                {
                    foreach (ArticleInfo objArticleInfo in objList)
                    {
                        objArticleInfo.IsDigg = objDiggInfoList.Any(c => c.ObjectId == objArticleInfo.ArticleId.ToString());
                    }
                }
            }
        }

        protected virtual void LoadDigg(ArticleInfo objArticleInfo)
        {
            BizDiggInfo objBizDiggInfo = new BizDiggInfo(CurrentCommunityConfig.ConnectionStringKey, CurrentCommunityConfig.DataObjectParam);
            if (objArticleInfo != null)
            {
                var objList = objBizDiggInfo.GetListCache("", TimeSpan.FromSeconds(5), "ObjectId=@ObjectId AND UserId=@UserId AND datediff(day,[DiggTime],getdate())=0", new { ObjectId = objArticleInfo.ArticleId, UserId = this.CurrentUserInfo.UserId });
                objArticleInfo.IsDigg = objList.Any(c => String.Equals(c.ObjectType, "Digg", StringComparison.OrdinalIgnoreCase));
                objArticleInfo.IsBury = objList.Any(c => String.Equals(c.ObjectType, "Bury", StringComparison.OrdinalIgnoreCase));
            }
        }
    }
}
